using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace teste.Models.Mapping
{
    public class DEPENDENTEMap : EntityTypeConfiguration<DEPENDENTE>
    {
        public DEPENDENTEMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            // Table & Column Mappings
            this.ToTable("DEPENDENTE");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.Codigo).HasColumnName("Codigo");
            this.Property(t => t.Nome).HasColumnName("Nome");
            this.Property(t => t.Cpf).HasColumnName("Cpf");
            this.Property(t => t.Cnh).HasColumnName("Cnh");
            this.Property(t => t.Cliente_Id).HasColumnName("Cliente_Id");

            // Relationships
            this.HasOptional(t => t.CLIENTE)
                .WithMany(t => t.DEPENDENTEs)
                .HasForeignKey(d => d.Cliente_Id);

        }
    }
}
